var editor = null ;
KISSY.ready(function (S) {
    S.use('editor,extends/ajax/ajax', function (S,editor,Ajax) {
		var $ = S.all ;
        var KE = KISSY.Editor;
        editor = KE("#editor", S.clone(edit_cfg)).use("elementpaths," +
            "sourcearea,preview," +
            "checkbox-sourcearea," +
            "templates,separator," +
            "undo,separator," +
            "removeformat,font,format,color,separator," +
            "list,indent," +
            "justify,separator,link," +
            "image,flash," +
            "video," +
            "music," +
            "xiami-music," +
            "smiley,separator,table,resize," +
            "draft," +
            "multi-upload," +
            "pagebreak,separator,maximize,dragupload");
        
        
        $("#click").on("click",function(){
        	var content = editor.getData();
        	var articleTypeId = $("#article_type_id").val();
        	var title = $("#title").val();
        	var keyUserName = $("#key_user_name").val();
        	var imageUrl = $("#upload_image_path").val();
        	var param = {articleTypeId:articleTypeId,
        				 title:title,
        				 content:content,
        				 keyUserName:keyUserName,
        				 imageUrl:imageUrl};
        	new Ajax($("#page_context_path").val()+"/page/article/add.jspx",param,function(data){
        		if("1" == data){
        			alert("添加成功")
        		}
        	})
        });
    });
});